<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<script>
			window.onload = function()
			{
				let btn = document.querySelector('button');
				// let name = document.querySelector('#name');
				// let country = document.querySelector('#country');
				let text = document.querySelectorAll('input');
				
				btn.onclick = function()
				{
					let name = text[0].value;
					let contry = text[1].value;
					alert('大家好，我叫${name} ,我来自${contry}国.');
				}
			}
		</script>
	</head>
	<body>
		<input type="text">
		<input type="text">
		<button>打招呼</button>
	</body>
</html>